/*
day49
2019.10.16
*/
#include<stdio.h>
#include<stdlib.h>

struct ListNode {
	int val;
	struct ListNode *next;
};


struct ListNode *detectCycle(struct ListNode *head) 
{
    struct ListNode *fast=head,*slow=head,*dec=head;
    while(fast)
    {
    	slow=slow->next;
    	for(int i=0;fast&&i<2;i++)
    	{
    		fast=fast->next;
		}
		if(fast==slow)
		{
			break;
		}
	}
	if(!fast) return NULL;
	
	while(dec!=slow)
	{
		dec=dec->next;
		slow=slow->next;
	}
	return slow;
}
int main()
{
	return 0;
}
